Add tests for passing both --bin and --lib
authorJonathan Turner <jturner@mozilla.com>
Fri, 29 Jul 2016 23:52:00 +0000 (16:52 -0700)
committerJonathan Turner <jturner@mozilla.com>
Fri, 29 Jul 2016 23:52:00 +0000 (16:52 -0700)
tests/init.rs
tests/new.rs

index f63b249d92905a4d7da9743f014a68b379e8b9c8..315394359d9eaf2f6919afe8d636f8e8189fdc57 100644 (file)
@@ -54,6 +54,15 @@ fn simple_bin() {
                 existing_file());
 }
 
+#[test]
+fn both_lib_and_bin() {
+    let td = TempDir::new("cargo").unwrap();
+    assert_that(cargo_process("init").arg("--lib").arg("--bin").cwd(td.path().clone())
+                                    .env("USER", "foo"),
+                execs().with_status(101).with_stderr(
+                    "[ERROR] can't specify both lib and binary outputs"));
+}
+
 fn bin_already_exists(explicit: bool, rellocation: &str) {
     let path = paths::root().join("foo");
     fs::create_dir_all(&path.join("src")).unwrap();
index e58a47188dd82327b08eee60ccc50479811d0113..b0d4163f16cd0a9d8c55be199499b76161c8915c 100644 (file)
@@ -55,6 +55,15 @@ fn simple_bin() {
                 existing_file());
 }
 
+#[test]
+fn both_lib_and_bin() {
+    let td = TempDir::new("cargo").unwrap();
+    assert_that(cargo_process("new").arg("--lib").arg("--bin").arg("foo").cwd(td.path().clone())
+                                    .env("USER", "foo"),
+                execs().with_status(101).with_stderr(
+                    "[ERROR] can't specify both lib and binary outputs"));
+}
+
 #[test]
 fn simple_git() {
     let td = TempDir::new("cargo").unwrap();